package eu.runelord.programmers.java.borderlayouttutorial;

import java.awt.BorderLayout;

import javax.swing.JButton;
import javax.swing.JFrame;

class BorderLayoutExample extends JFrame {

	private static final long serialVersionUID = 5542988826027886015L;

	public static void main(String[] args) {
		BorderLayoutExample borderLayoutExample = new BorderLayoutExample();
		borderLayoutExample.setVisible(true);
	}
	
	public BorderLayoutExample() {
		init();
	}
	
	private void init() {
		BorderLayout borderLayout = new BorderLayout();
		JButton n = new JButton("NORTH"), s = new JButton("SOUTH"), w = new JButton(
				"WEST"), e = new JButton("EAST"), c = new JButton("CENTER");
		setLayout(borderLayout);
		setTitle("Przykład BorderLayout");
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		add(n);
		add(s);
		add(w);
		add(e);
		add(c);
		borderLayout.addLayoutComponent(n, BorderLayout.NORTH);
		borderLayout.addLayoutComponent(s, BorderLayout.SOUTH);
		borderLayout.addLayoutComponent(w, BorderLayout.WEST);
		borderLayout.addLayoutComponent(e, BorderLayout.EAST);
		borderLayout.addLayoutComponent(c, BorderLayout.CENTER);
		validate();
		pack();		
	}
}
